import { request } from '@vipl520/utils'
const path = '/' + import.meta.env.VITE_BASE_ADDON_NAME + '/diy/'

export function saveDesign(diyData, codeData, diy_id = 0) {
  return request({
    url: path + 'saveDesign',
    method: 'post',
    data: { diyData, codeData, diy_id }
  })
}

export function getList(page, size, search = {}) {
  return request({
    url: path + 'index',
    method: 'get',
    params: { page, size, search, order: 'id desc' }
  })
}

export function getForm(id) {
  return request({
    url: path + 'getForm',
    method: 'post',
    data: { id }
  })
}

// 删除
export function del(id) {
  return request({
    url: path + 'delete',
    method: 'post',
    data: { id }
  })
}

export function getById(id) {
  return request({
    url: path + 'getById',
    method: 'post',
    data: { id }
  })
}
